package com.project.common.controller;

import com.project.common.entity.PageVo;
import com.project.common.entity.SysAuthorization;
import com.project.common.service.SysAuthorizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/sysAuthorization")
public class SysAuthorizationController {
    @Autowired
    private SysAuthorizationService sysAuthorizationService;
    @PostMapping("/queryAllSysAuthorizations.action")
    public PageVo<SysAuthorization> queryAllSysAuthorizations(@RequestBody Map<String,String> map){
        PageVo<SysAuthorization> sysAuthorizationPageVo = sysAuthorizationService.queryAllSysAuthorization(map);
//        System.out.println(sysAuthorizationPageVo.toString());
        return sysAuthorizationPageVo;
    }
    @PostMapping("/queryAuthorizationsByRoleId.action")
    public List<SysAuthorization> queryAuthorizationsByRoleId(Integer roleId){
        List<SysAuthorization> sysAuthorizations = sysAuthorizationService.querySysAuthorizationByRoleId(roleId);
        return sysAuthorizations;
    }
}
